package com.atguigu.yygh.Controller;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.model.hosp.Department;
import com.atguigu.yygh.service.DepartmentService;
import com.atguigu.yygh.vo.hosp.DepartmentVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description: TODO
 * @author: 化一帆
 * @date: 2022/11/30 11:15
 * @version: v1.0
 */
@RestController
@RequestMapping("/admin/hosp/department")
//@CrossOrigin
public class DepartmentController {
    @Autowired
    private DepartmentService departmentService;

    /**
     * @description: 根据医院编号，查询医院所有科室列表
     * @author 化一帆
     * @date 2022/11/30 11:16
     */
    @ApiOperation(value = "查询医院所有科室列表")
    @GetMapping("getDeptList/{hoscode}")
    public R getDeptList(@PathVariable String hoscode){
      List<DepartmentVo> list= departmentService.findDeptTree(hoscode);
      return R.ok().data("list",list);
    }
}
